<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>组件参数校验与非props特性</title>
    <script src="./js/vue.js"></script>
</head>
<body>
    <div id="root">
        <child :content="'{a:1}'"></child>
    </div>
    <script>
        Vue.component('child', {
            props: {
                content: {
                    type: [Number, String],
                    required: true,
                    default: 'I like vue',
                    validator: function(value){
                        return (value.length) > 2
                    }
                }
            },
            template: '<div>{{content}}</div>'
        });
        var vm = new Vue({
            el: "#root"
        })
    </script>
</body>
</html>